using System.Collections.Generic;
using MvpFramework;
using NUnit.Framework;
using Rhino.Mocks;

namespace MvpFramework.UnitTests
{
    [TestFixture]
    public class When_a_presenter_needs_to_navigate
    {
        private MockRepository mocker;
        private Presenter<IMvpView> presenter;
        private INavigator navigator;
        private IMvpView view;

        [SetUp]
        public void Arrange()
        {
            mocker = new MockRepository();
            navigator = mocker.DynamicMock<INavigator>();
            view = mocker.DynamicMock<IMvpView>();
        }
        public void Act()
        {
            mocker.ReplayAll();
            presenter = mocker.DynamicMock<Presenter<IMvpView>>(view,navigator);
            mocker.Replay(presenter);
        }
        [TearDown]
        public void AssertAll()
        {
            mocker.VerifyAll();
        }
        [Test]
        public void it_can_use_the_navigateTo_string_property_on_Navigator()
        {
            const string navigateTo = "NavigateHere";
            Act();
            presenter.NavigateTo(navigateTo);
        }
        [Test]
        public void it_can_use_the_strongly_typed_NavigateTo_view_method()
        {
            navigator.NavigateTo<IMvpView>();
            Act();
            presenter.NavigateTo<IMvpView>();
        }
        [Test]
        public void it_can_specify_options_and_send_a_strongly_typed_view()
        {
            var options = new Dictionary<string, object> {{"key", "value"}};
            navigator.NavigateTo<IMvpView>(options);
            Act();
            presenter.NavigateTo<IMvpView>(options);
        }
    }
}